package com.xbongbong.admin.model.impl;

import com.xbongbong.admin.domain.dao.MirrorMenuDao;
import com.xbongbong.admin.domain.entity.MirrorMenuEntity;
import com.xbongbong.admin.model.MirrorMenuModel;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.util.DateUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 镜像菜单配置
 * @author xingxing.xiao
 * @date 2020/01/09 16:32
 */
@Service("mirrorMenuModel")
public class MirrorMenuModelImpl implements MirrorMenuModel {

    @Resource
    private MirrorMenuDao mirrorMenuDao;

    @Override
    public Integer insert(MirrorMenuEntity entity) throws XbbException {
        long now = DateUtil.getInt();
        entity.setAddTime(now);
        entity.setUpdateTime(now);
        return mirrorMenuDao.insert(entity);
    }

    @Override
    public Integer update(MirrorMenuEntity entity) throws XbbException {
        long now = DateUtil.getInt();
        entity.setUpdateTime(now);
        return mirrorMenuDao.update(entity);
    }

    @Override
    public List<MirrorMenuEntity> findEntitys(Map<String, Object> param) {
        return mirrorMenuDao.findEntitys(param);
    }

    @Override
    public List<MirrorMenuEntity> insertBatch(List<MirrorMenuEntity> list) {
        mirrorMenuDao.insertBatch(list);
        return list;
    }

    @Override
    public MirrorMenuEntity getByKey(Long key) {
        return mirrorMenuDao.getByKey(key);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return mirrorMenuDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }
}
